package com.pine.dbant.common.plugin;

import com.pine.dbant.common.model.CommandStatement;

import java.util.List;

/**
 * @author xiaoyuan
 * @create 2022/11/15
 **/
public interface ExecuteCallback<T extends ExecuteRecord,S extends CommandStatement> {

    /**
     * 执行前调用
     * @param statements
     */
    default void beforeExecute(List<S> statements) {

    }

    /**
     * 单挑sql执行前调用
     * @param statement
     */
    default void beforeOneExecute(CommandStatement statement) {

    }

    /**
     * 返回执行结果
     * @param executeRecord
     */
    void processRow(T executeRecord);

    /**
     * 执行完毕sql后调用
     * @param statement
     * @param executeRecord
     */
    default void afterOneExecute(S statement, T executeRecord) {

    }
}
